[#include "/common/common.html"]
<!DOCTYPE HTML>
<html>
	<head>
		<title>角色管理</title> [#include "/common/import.html"]
		<script type="text/javascript">
		$(function(){
			$('#privilege').treeSelector({
				url : '${ctx}/admin/sys/privilege!tree.action',
				choiceName:'privilege_id',
				hiddenName:'privilegeIds'
			});
			$('#user').treeSelector( {
				url : '${ctx}/admin/sys/user!tree.action',
				choiceName : 'user_id',
				hiddenName : 'userIds'
			});
		});
		</script>
	</head>

	<body>
		[@s.actionmessage theme="custom" cssClass="success" /]
		<form action="${ctx}/admin/sys/role!save.action" method="post">
			<input type="hidden" name="id" value="${id!}" />
			<input type="hidden" name="page.pageNo" value="${page.getPageNo()}" />
			<table cellpadding="0" cellspacing="1" class="tab">
				<tr>
					<th colspan="2" align="left">
						[#if !id??] 添加角色 [#else] 修改角色 [/#if]
					</th>
				</tr>
				<tr class="tdbg">
					<td width="15%" align="right">
						名称：
					</td>
					<td>
						<input type="text" name="name" value="${name!}" reg="." />
						<span name="easyTip"></span>
					</td>
				</tr>
				<tr class="tdbg">
					<td width="15%" align="right">
						编号：
					</td>
					<td>
						<input type="text" name="code" value="${code!}" reg="." />
						<span name="easyTip"></span>
					</td>
				</tr>
				<tr class="tdbg">
					<td width="15%" align="right">
						权限：
					</td>
					<td>
						<div id="privilege">
							[#list privileges! as entity]
							<div style='padding-top: 3px; color: blue;'>
								${entity.name!}
								<a href='javascript:void(0);'
									onclick='$(this).parent().remove();' style='color: red;'>X</a>
								<input type='hidden' name='privilegeIds' value='${entity.id!}' />
							</div>
							[/#list]
						</div>
					</td>
				</tr>
				<tr class="tdbg">
					<td width="15%" align="right">
						用户：
					</td>
					<td>
						<div id="user">
							[#list users! as entity]
							<div style='padding-top: 3px; color: blue;'>
								${entity.name!}
								<a href='javascript:void(0);'
									onclick='$(this).parent().remove();' style='color: red;'>X</a>
								<input type='hidden' name='userIds' value='${entity.id!}' />
							</div>
							[/#list]
						</div>
					</td>
				</tr>
				<tr class="tdbg">
					<td width="15%" align="right"></td>
					<td>
						<input type="submit" class="btn" value="保 存">
						<input type="reset" class="btn" value="重 置">
					</td>
				</tr>
			</table>
		</form>
	</body>
</html>